<html>
<head>
    <title>XBRLAPI: Getting started on MS Windows (TM)</title>
    <link rel="stylesheet" href="/css/styles.css" type="text/css"/>
    <script type="text/javascript">
        var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
        document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
    </script>
    <script type="text/javascript">
        try {
            var pageTracker = _gat._getTracker("UA-11401995-1");
            pageTracker._setDomainName("none");
            pageTracker._setAllowLinker(true);
            pageTracker._trackPageview();
        } catch (err) {
        }</script>
</head>


<body>

<div class="logo_container"><span class="logo"> <a
        class="title" href="/">XBRLAPI</a> </span> <span class="logo_subscript">
<a class="title"
   href="http://en.wikipedia.org/wiki/Free_and_open_source_software">Free
    Open-Source Software</a> </span></div>

<div id="navcontainer">
    <form action="http://www.xbrlapi.org/search.html" id="cse-search-box">
        <div><input type="hidden" name="cx"
                    value="partner-pub-3957505011939955:jqid48zd81o"/> <input
                type="hidden" name="cof" value="FORID:10"/> <input type="hidden"
                                                                   name="ie" value="ISO-8859-1"/> <input type="text"
                                                                                                         name="q"
                                                                                                         size="31"/>
            <input type="submit" name="sa" value="Search"/></div>
    </form>

    <script type="text/javascript"
            src="http://www.google.com/cse/brand?form=cse-search-box&amp;lang=en">
    </script>

    <ul id="navlist">
        <li><a href="/">Home</a></li>
        <li><a href="/gettingStarted">Installation</a></li>
    </ul>

    <script type="text/javascript"><!--
    google_ad_client = "pub-3957505011939955";
    /* XBRLAPI site */
    google_ad_slot = "4927123290";
    google_ad_width = 160;
    google_ad_height = 600;
    //-->
    </script>
    <script type="text/javascript"
            src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
</div>

<div class="content">
    <h1>XBRLAPI installation and configuration on MS Windows (TM)</h1>

    <h2>Overview</h2>

    <p>This page is relevant to those looking to use XBRLAPI in their
        own MS Windows environment.</p>

    <h3>Install Java</h3>

    <p>Download and install the latest <a
            href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">Java
        JDK for Windows</a>.</p>

    <p>Ensure the Java bin folder path is added to the PATH variable
        under System Variables. Select Start -&gt; My Computer -&gt; System
        Properties -&gt; Advanced system settings -&gt; Advanced tab -&gt;
        Environment Variables -&gt; System variables -&gt; PATH. Prepend <code>C:\Program
            Files\Java\jdk1.6.0_22\bin;</code> to the beginning of the PATH variable (Note
        that the jdk number will depend on which version of Java you have
        downloaded).</p>

    <p>To check that Java has been installed correctly, type java
        -version at the command line. It should come back with whatever version
        you have installed.</p>

    <h3>Install Oracle Berkeley XML Database</h3>

    <p>Download and run <a
            href="http://www.oracle.com/technetwork/database/berkeleydb/downloads/index.html">the
        latest Oracle Berkeley DB XML database</a> MSI Windows Installer</p>

    <p>Follow the prompts for the MS Installer file and select the
        option to update environment variables.</p>

    <p>Ensure the Oracle bin folder path is on the PATH variable under
        System Variables as done above for Java but prepending the PATH with <code>C:\Program
            Files\Oracle Berkeley DB XML 2.5.16\bin;</code></p>

    <p>Ensure that the db.jar and dbxml.jar files distributed with the
        Oracle database are on the CLASSPATH System Variable. Select Start -&gt;
        My Computer -&gt; System Properties -&gt; Advanced system settings -&gt;
        Advanced tab -&gt; Environment Variables -&gt; System variables -&gt;
        CLASSPATH</p>

    <p>Prepend the CLASSPATH sytem variable value with <code>C:\Program
        Files\Oracle\Berkeley DB XML 2.5.16\jar\dbxml.jar;C:\Program
        Files\Oracle\Berkeley DB XML 2.5.16\jar\db.jar;</code></p>

    <p><a href="http://sourceforge.net/projects/xbrlapi"><img
            src="http://sflogo.sourceforge.net/sflogo.php?group_id=135539&type=11"
            width="120" height="30" border="0"
            alt="Get Java XBRL API implementation at SourceForge.net. Fast, secure and Free Open Source software downloads"/></a>
    </p>

    <h2>XBRLAPI Installation</h2>

    <p>There are two options: one for commandline usage of the API and
        one for usage within Eclipse.</p>

    <p>The command line involves fewer installations and is thus
        initially a quicker solution. However, Eclipse IDE (or any IDE) makes it
        easier to run programs and set their arguments (since you can save the
        arguments in Eclipse as default whenever you run the program, while you
        have to manually record what arguments you use on the command line) and
        allows you to navigate through programs to better understand what is
        being referenced, among other things. If you are planning to use this
        XBRLAPI for extended interactions with the XBRL data, using an IDE is a
        good idea.</p>

    <h3>Install the XBRLAPI for commandline usage (option 1)</h3>

    <p>Download the latest single <a
            href="http://sourceforge.net/projects/xbrlapi/files/">xbrlapi-X.X.jar</a>
        from Sourceforge.</p>

    <p>Ensure that the XBRLAPI jar file is on your Java CLASSPATH. The
        easiest way to do this is to put the jar files in the <code>jre\lib\ext</code>
        directory under the Java path (for example, <code>C:\Program
            Files\Java\jdk1.6.0_22\jre\lib\ext</code>).</p>

    <h3>Install the XBRLAPI for usage within Eclipse (option 2)</h3>

    <h4>Set up Eclipse</h4>

    <p>Download <a href="http://www.eclipse.org/downloads/">Eclipse
        IDE</a> for Java EE Developers.</p>

    <p>Unzip the eclipse file into a directory. It’s recommended that
        the directory be close to the root (for example, C:\Eclipse). Once the
        file is unzipped, simply open Eclipse by running the eclipse.exe file.</p>

    <p>Ensure there are no additional files in the jre\lib\ext directory
        beyond the ones standard with Java (this sometimes causes Eclipse to use
        the wrong libraries). So, if you put the XBRLAPI jar files and Oracle
        jar files in the jre\lib\ext directory for command line installation,
        you’ll need to remove them for Eclipse to run.</p>

    <p>Run/open Eclipse by double-clicking or running eclipse.exe in the
        Eclipse folder. There is no installation step; you simply run the
        executable file.</p>

    <h4>Install the Subversion Eclipse Plugin</h4>

    <p>This step is necessary for you to checkout/download the current
        XBRLAPI source files and quickly update to reflect any future changes</p>

    <p>In Eclipse, go to Help-&gt; Install New Software -&gt; Available
        Software Sites and search for &quot;subversive&quot;. Select the Eclipse
        Subversive Download site (community.polarion.com) and click the &quot;Add&quot;
        button</p>

    <p>Back on the original Eclipse Available Software Sites dialog box,
        select the Subversive site from the drop-down list by the words &quot;Work
        with:&quot;</p>

    <p>Select the checkbox next to &quot;Subversive SVN Connectors&quot; and
        follow the steps to install the software.</p>


    <h4>Set up a connection to the XBRLAPI project</h4>

    <p>In Eclipse, go to Window -&gt; Open Perspective-&gt; Other-&gt;
        SVN Repository Exploring</p>

    <p>Create a new repository location by clicking on the drop-down
        portion of the &quot;New&quot; icon on the left of the toolbar and selecting &quot;New
        Repository Location&quot;</p>

    <p>Enter <code>https://xbrlapi.svn.sourceforge.net/svnroot/xbrlapi</code>
        as the URL.</p>

    <p>Expand the XBRLAPI subversion repository to show the branches and
        trunk. Right-click on the trunk and choose &quot;Check-out&quot;.</p>

    <h4>Configure the XBRLAPI project properties</h4>

    <p>Go to Window -&gt; Open Perspective -&gt; Java and right-click on
        the trunk of the xbrlapi project and choose &quot;Properties&quot;. Choose &quot;Java
        Build Path&quot; from the list of properties in the dialog box and then the
        &quot;Libraries&quot; tab.</p>

    <p>Make sure the following libraries are listed:</p>

    <ul>
        <li>JRE System Library</li>
        <li>xbrlapi.org user library</li>
    </ul>

    <p>If the libraries are not listed, add them by choosing &quot;Add
        Library...&quot; -&gt; User Library -&gt; &quot;User Libraries...&quot; -&gt; &quot;New...&quot; and
        then adding the relevant jar files by using &quot;Add JARs...&quot; and selecting
        the jars in the java\lib directory in your Eclipse project folder.</p>

    <h2>Running a simple example</h2>

    <h3>General preparations</h3>

    <p>Create a folder called &quot;container&quot; (or whatever you want) that
        will hold the Oracle database files to be created.</p>

    <p>Create a folder called &quot;cache&quot; (or whatever you want) that will
        be used by the programs to cache copies of XBRL documents that are
        loaded into the data store. This cache allows you to operate offline
        after the first interaction with the XBRL files.</p>

    <h3>Commandline example</h3>

    <p>An example command to load the XBRL 2.1 instance schema might be:</p>

    <pre>java -Xmx1g -Dlog4j.configuration=log4j.xml org.xbrlapi.data.bdbxml.examples.load.Load -database C:\Documents\XBRLAPI\container -container TestContainer -cache C:\Documents\XBRLAPI\cache http://www.xbrl.org/2003/xbrl-instance-2003-12-31.xsd</pre>

    <p>The Xmx1g option increases the java heap size. Use this if you
        get java.lang.OutofMemoryError.</p>

    <p>The Dlog4j.configuration option specifies the location and name
        of the LOG4J logging configuration file.</p>

    <p>The database argument is the directory you want to store the new
        container in. Create this folder before running the command.</p>

    <p>The container argument is the name you want assigned to the
        dataset. This can be anything.</p>

    <p>The cache argument is the directory you want to the program to
        store various files in. Create this folder before running the command.</p>

    <p>The URL is the address for the instance document or schema you
        want stored in the dataset. This can be any xbrl file.</p>

    <p>Keep in mind for all these directory paths that any spaces in the
        paths will cause Windows trouble at the command line. Avoid spaces if
        possible. If you can't avoid them, consider making a symbolic reference
        (i.e. shortcut) to the directory. For example, type mklink /d C:\xbrl_db
        &quot;C:\Sample Path\XBRL API&quot; at the command line to make a shortcut
        reference C:\xbrl_db that points to the directory C:\Sample Path\XBRL
        API (which has problematic spaces).</p>


    <h3>Eclipse example</h3>

    <p>Access the Java perspective by clicking on Window -&gt; Open
        Perspective -&gt; Java</p>

    <p>Open the class: <code>org.xbrlapi.data.bdbxml.examples.load.Load.java</code></p>

    <p>Set configurations by going to Run-&gt; Run Configurations and
        choosing to set configurations for a Java Application called Load. Make
        sure the main class is listed as
        <code>org.xbrlapi.data.bdbxml.examples.load.Load</code></p>

    <p>Set the following Program arguments (without quotes, but with a
        space or line break between each argument), using the path for your
        xbrlapi data instead of C:\Documents\XBRLAPI (See the description of
        each argument in the Command Line instructions above)</p>

    <ol>
        <li>(only if you have 2 GB RAM or have gotten errors about not
            enough memory) &quot;-dbCacheSize 500&quot;</li>
        <li>-database C:\Documents\XBRLAPI\container</li>
        <li>-container TestContainer</li>
        <li>-cache C:\Documents\XBRLAPI\cache</li>
        <li>http://www.xbrl.org/2003/xbrl-instance-2003-12-31.xsd</li>
    </ol>

    <p>Set the following VM argument: <code>-Xmx1g</code></p>

    <p>Select &quot;Apply&quot; to save and apply the arguments, and then select
        &quot;Run&quot; to run the program. The Console at the bottom of the screen should
        show that the document was successfully added.</p>

    <h2>Troubleshooting</h2>

    <p>If you get errors that seem to be about the Oracle Berkeley
        database (for example, &quot;no libdb_java48&quot;), make sure that Oracle bin
        folder path is at the beginning of the PATH variable (before the Java
        bin folder) (as specified above). Also make sure that the Oracle db.jar
        and dbxml.jar files are in the CLASSPATH variable (as specified above).</p>


    <p>If you get errors about the amount of storage space (for example,
        &quot;PANIC: Not enough space&quot;), make sure to specify the Oracle database
        cache size as smaller (500MB, for example) as an argument when running
        Java programs. This is a parameter to the
        org.xbrlapi.bdbxml.data.StoreImpl constructor.</p>

    <p>If you get errors about classes not being found, try
        downloading the dependency jars from <a
                href="http://xbrlapi.svn.sourceforge.net/viewvc/xbrlapi/trunk/java/lib/">http://xbrlapi.svn.sourceforge.net/viewvc/xbrlapi/trunk/java/lib/</a>
        and adding them to the Java CLASSPATH.</p>

    <p>
        This page has been contributed by Beth Blankespoor.
    </p>

    <p>
        <a href="http://sourceforge.net/projects/xbrlapi"><img
                src="http://sflogo.sourceforge.net/sflogo.php?group_id=135539&type=11" width="120" height="30"
                border="0"
                alt="Get Java XBRL API implementation at SourceForge.net. Fast, secure and Free Open Source software downloads"/></a>
    </p>

</div>

</body>
</html>
